import { t } from '@/locales/i18n';

import { FlowNodeInputTypeEnum, NodeInputKeyEnum, WorkflowIOValueTypeEnum } from '../constant';
import { FlowNodeInputItemType } from '../io';

import { chatNodeSystemPromptTip, systemPromptTip } from './tip';

export const Input_Template_History: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.history,
  renderTypeList: [FlowNodeInputTypeEnum.numberInput, FlowNodeInputTypeEnum.reference],
  valueType: WorkflowIOValueTypeEnum.chatHistory,
  label: t('core.module.input.label.chat history'),
  description: t('max_dialog_rounds'),

  required: true,
  min: 0,
  max: 50,
  value: 6,
};

// eslint-disable-next-line @typescript-eslint/naming-convention
export const Input_Template_UserChatInput: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.userChatInput,
  renderTypeList: [FlowNodeInputTypeEnum.reference, FlowNodeInputTypeEnum.textarea],
  valueType: WorkflowIOValueTypeEnum.string,
  label: t('text_classification'),
  toolDescription: t('text_classification_desc'),
  required: true,
};
export const User_Input_Template_UserChatInput: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.userChatInput,
  renderTypeList: [FlowNodeInputTypeEnum.reference, FlowNodeInputTypeEnum.textarea],
  valueType: WorkflowIOValueTypeEnum.string,
  label: t('user_question'),
  toolDescription: t('user_question_tool_desc'),
  required: true,
};

export const Input_Template_UserChatInput2: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.userChatInput2,
  renderTypeList: [FlowNodeInputTypeEnum.reference, FlowNodeInputTypeEnum.textarea],
  valueType: WorkflowIOValueTypeEnum.string,
  label: '函数参数（Json）',
  toolDescription: t('user_question_tool_desc'),
  required: false,
};
export const Input_Template_DynamicInput: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.addInputParam,
  renderTypeList: [FlowNodeInputTypeEnum.addInputParam],
  valueType: WorkflowIOValueTypeEnum.dynamic,
  label: '',
  required: false,
};
export const Input_Template_DynamicInput2: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.addInputParam2,
  renderTypeList: [FlowNodeInputTypeEnum.addInputParam],
  valueType: WorkflowIOValueTypeEnum.dynamic,
  label: '',
  required: false,
};
export const Input_Template_SelectAIModel: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.aiModel,
  renderTypeList: [FlowNodeInputTypeEnum.selectLLMModel, FlowNodeInputTypeEnum.reference],
  label: t('core.module.input.label.aiModel'),
  required: true,
  valueType: WorkflowIOValueTypeEnum.string,
};
export const Input_Template_SettingAiModel: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.aiModel,
  renderTypeList: [FlowNodeInputTypeEnum.settingLLMModel, FlowNodeInputTypeEnum.reference],
  label: t('core.module.input.label.aiModel'),
  valueType: WorkflowIOValueTypeEnum.string,
};

export const Input_Template_System_Prompt: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.aiSystemPrompt,
  renderTypeList: [FlowNodeInputTypeEnum.textarea, FlowNodeInputTypeEnum.reference],
  max: 3000,
  valueType: WorkflowIOValueTypeEnum.string,
  label: t('core.ai.Prompt'),
  description: systemPromptTip,
  placeholder: chatNodeSystemPromptTip,
};

export const Input_Template_Dataset_Quote: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.aiChatDatasetQuote,
  renderTypeList: [FlowNodeInputTypeEnum.settingDatasetQuotePrompt],
  label: '',
  debugLabel: t('knowledge_base_reference'),
  description: '',
  valueType: WorkflowIOValueTypeEnum.datasetQuote,
};
export const Input_Template_Text_Quote: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.stringQuoteText,
  renderTypeList: [FlowNodeInputTypeEnum.reference, FlowNodeInputTypeEnum.textarea],
  label: t('document_quote'),
  debugLabel: t('document_quote'),
  description: t('document_quote_tip'),
  valueType: WorkflowIOValueTypeEnum.string,
};
export const Input_Template_File_Link: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.fileUrlList,
  renderTypeList: [FlowNodeInputTypeEnum.reference],
  required: true,
  label: t('workflow.user_file_input'),
  debugLabel: t('workflow.user_file_input'),
  description: t('workflow.user_file_input_desc'),
  valueType: WorkflowIOValueTypeEnum.arrayString,
};

export const Input_Template_Children_Node_List: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.childrenNodeIdList,
  renderTypeList: [FlowNodeInputTypeEnum.hidden],
  valueType: WorkflowIOValueTypeEnum.arrayString,
  label: '',
  value: [],
};
export const Input_Template_Node_Width: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.nodeWidth,
  renderTypeList: [FlowNodeInputTypeEnum.hidden],
  valueType: WorkflowIOValueTypeEnum.number,
  label: '',
  value: 900,
};
export const Input_Template_Node_Height: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.nodeHeight,
  renderTypeList: [FlowNodeInputTypeEnum.hidden],
  valueType: WorkflowIOValueTypeEnum.number,
  label: '',
  value: 900,
};

export const Input_Template_Stream_MODE: FlowNodeInputItemType = {
  key: NodeInputKeyEnum.forbidStream,
  renderTypeList: [FlowNodeInputTypeEnum.switch],
  valueType: WorkflowIOValueTypeEnum.boolean,
  label: t('template.forbid_stream'),
  description: t('template.forbid_stream_desc'),
  value: false,
};
